package com.ywk.mybatisPlus;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

/**
 * @Author zbh
 * @Date 2023/6/28
 */
@SpringBootApplication
@MapperScan(basePackages = {"com.ywk.mybatisPlus.business.mapper"})
public class MybatisPlusMainApplication {

    public static void main(String[] args) {
        SpringApplication.run(MybatisPlusMainApplication.class,args);
    }

    /**
     * MyBatis-Plus自带分页插件
     * @return
     */
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }

}
